package com.kgame5.xtank3d.effect.myemitters {
import kgame5.k3d.core.obj3d.node3d.Node3D;
import kgame5.k3d.core.obj3d.node3d.group3d.FastGroup3D;
import kgame5.k3d.pars.myflint.geom.Vector3DFlint;
import kgame5.k3d.pars.myflint.zones.MyDiscZone;
import kgame5.kgu.spacial.SpacialManager;
import kgame5.kmath.MathDG;

import com.kgame5.xtank3d.effect.MyEmitter;
import com.kgame5.xtank3d.resource.ResourceManagerX;

/**
 * @author kk
 * 弹壳
 */
public class ShotShellEmitter extends MyEmitter{
		
	public function ShotShellEmitter(y:int,rotY:int) {
		//创建一个表示弹壳的模型
		var md:Node3D=ResourceManagerX.getInstance().getShotShell(null);
		
		md.ti.hardVO.v3d_p.y=y;
		
		var fireRotation:Number=rotY+180;
		
		var rad:Number=MathDG.DTR*fireRotation;
		var speedZone:MyDiscZone=new MyDiscZone(Vector3DFlint.ZERO, Vector3DFlint.AXISY, 12);
		var v:Vector3DFlint=speedZone.getLocationByRad(12, rad);
		v.y=10;
			
		md.ti.hardVO.v3d_v.fill(v.x, v.y, v.z);
		
		md.ti.hardVO.v3d_a.y=SpacialManager.G;
		
		var initAngleXOZ:int=MathDG.C360(fireRotation);
			
			var rv:Number=20;
			
			var 
				rvx:Number=20,
				rvy:Number=0,
				rvz:Number=0;
		
//			switch(initAngleXOZ){
//				case 180:
//				rvx=rv;
//				break;
//				case 0:
//				rvx=-rv;
//				break;
//				case 90:
//				rvz=-rv;
//				break;
//				case 270:
//				rvz=rv;
//				break;
//			}
			
			
		md.ti.hardVO.v3d_r.y=initAngleXOZ;
		md.ti.hardVO.v3d_rv.fill(rvx, rvy, rvz);
		md.life=-1;
		//--
		md_g.addChild(md);
	}
}
}
